import { request } from '@/utils/request.js'

export default {
    /**
     * 获取分类树
     * @returns
     */
    getList(params = {}) {
        return request({
            url: 'cms/category/index',
            method: 'get',
            params
        })
    },

    /**
     * 从回收站获取分类树
     * @returns
     */
    getRecycleList(params = {}) {
        return request({
            url: 'cms/category/index',
            method: 'get',
            params: {
                recycle: true
            }
        })
    },

    /**
     * 获取分类选择树
     * @returns
     */
    tree() {
        return request({
            url: 'cms/category/tree',
            method: 'get'
        })
    },

    /**
     * 添加分类
     * @returns
     */
    save(params = {}) {
        return request({
            url: 'cms/category/save',
            method: 'post',
            data: params
        })
    },

    /**
     * 移到回收站
     * @returns
     */
    deletes(data) {
        return request({
            url: 'cms/category/delete',
            method: 'delete',
            data
        })
    },

    /**
     * 恢复数据
     * @returns
     */
    recoverys(data) {
        return request({
            url: 'cms/category/recovery',
            method: 'put',
            data
        })
    },

    /**
     * 真实删除
     * @returns
     */
    realDeletes(data) {
        return request({
            url: 'cms/category/realDelete',
            method: 'delete',
            data
        })
    },

    /**
     * 更新数据
     * @returns
     */
    update(id, params = {}) {
        return request({
            url: 'cms/category/update/' + id,
            method: 'put',
            data: params
        })
    },

    /**
     * 数字运算操作
     * @returns
     */
    numberOperation(data = {}) {
        return request({
            url: 'cms/category/numberOperation',
            method: 'put',
            data
        })
    },

    /**
     * 更改分类状态
     * @returns
     */
    changeStatus(data = {}) {
        return request({
            url: 'cms/category/changeStatus',
            method: 'put',
            data
        })
    },
}
